home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
misc
/
football
/
exec
/
readmatchdata.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-11-29
|
5KB
|
148 lines
/* ***********************************************************************
READ MATCH DATA PROGRAM FOR FOOTBALL REXX SUITE
-------------------------------------------------
Copyright Mark Naughton 1999
Version Date History
--------------------------------------------------------------------------
1.0 240999 Created. Reads data for a match using match number.
021099 Bug fixed where the code would interpret the attendance
as an away match stat - reported by Heiko Schroder.
**************************************************************************
Procedure
---------
1. Split argument into league-name and match.
2. Check schedule learn file exists. Delete output file if it exists.
3. Read learn file, checking until the match number is found. When it is,
read the data, splitting it into different types and store in an array.
4. If we have some data to write, write to the temporary file. Exit.
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.sflearn'
separator = '*'
sdlines. = '???'
sdcount = 0
parse var league_stuff league_file mkr
league_file = "Data/"league_file
if exists(league_file || input_file) = 0 then
exit
if mkr < 0 then exit
output_file = "RAM:ReadMatchData.temp"
if exists(output_file) > 0 then
address command 'c:Delete >NIL: 'output_file
mkm = 0
mka = 0
if open(datafile3,league_file || input_file,'r') then do
do while ~eof(datafile3)
line = readln(datafile3)
if pos(separator,line) = 0 then
mkm = mkm + 1
if mkm > mkr then
mka = 0
if mkm = mkr & mka = 0 then do
mka = 1
sdcount = sdcount + 1
sdlines.sdcount = "*HO="strip(substr(line,1,30))
sdcount = sdcount + 1
sdlines.sdcount = "*AW="strip(substr(line,41,30))
sdcount = sdcount + 1
sdlines.sdcount = "*SH="strip(substr(line,32,2))
sdcount = sdcount + 1
sdlines.sdcount = "*SA="strip(substr(line,37,2))
end
if mka = 1 then do
if pos("*H",line) > 0 | (pos("*A",line) > 0 & pos("*ATD",line) = 0) then do
tim = ""
typ = 0
if pos("(P)",line) > 0 then typ = 1
if pos("(og)",line) > 0 then typ = 2
if typ ~= 0 then do
l1 = strip(word(line,words(line)-1,1))
if datatype(l1) = "NUM" then do
tim = l1
line = strip(delword(line,words(line)))
end
line = strip(delword(line,words(line),1))
end
if typ = 0 then do
l2 = strip(word(line,words(line),1))
if datatype(l2) = "NUM" then do
tim = l2
line = strip(delword(line,words(line),1))
end
end
if pos("Y=",line) > 0 then typ = 3
if pos("YR=",line) > 0 then typ = 4
if pos("HR=",line) > 0 then typ = 5
if pos("AR=",line) > 0 then typ = 5
if pos("S=",line) > 0 then typ = 6
if pos("M=",line) > 0 then typ = 7
if pos("*H",line) > 0 then do
parse var line "*H" . "=" player
sdcount = sdcount + 1
sdlines.sdcount = "*HP="strip(player)
if tim ~= "" then do
sdcount = sdcount + 1
sdlines.sdcount = "*HMM="tim
end
sdcount = sdcount + 1
sdlines.sdcount = "*HTYP="typ
end
if pos("*A",line) > 0 then do
parse var line "*A" . "=" player
sdcount = sdcount + 1
sdlines.sdcount = "*AP="strip(player)
if tim ~= "" then do
sdcount = sdcount + 1
sdlines.sdcount = "*AMM="tim
end
sdcount = sdcount + 1
sdlines.sdcount = "*ATYP="typ
end
end
if pos("*RF=",line) > 0 then do
sdcount = sdcount + 1
sdlines.sdcount = strip(line)
end
if pos("*ATD=",line) > 0 then do
sdcount = sdcount + 1
sdlines.sdcount = strip(line)
end
end
if mkm > mkr then do /* exit when we've read our data */
leave
end
end
close(datafile3)
end
if sdcount > 0 then do
if open(datafile2,output_file,'w') then do
do i=1 to sdcount
if sdlines.i ~= "" | sdlines.i ~= "???" then
writeln(datafile2,strip(sdlines.i))
end
close(datafile2)
end
end
exit
/* *********************************************************************** */